#include <iostream>

using std::cout;
using std::endl;

//模板的参数类型：类型参数和非类型参数
//T类型：将其称为类型参数(typename/class之后的参数)
//kMin类型：将其称为非类型参数,非类型参数必须是整形：
//char/short/int/long/void *,不能是浮点型：float/double
//
//模板参数列表中的参数是可以进行写默认值的
//对于模板参数列表中参数，设置默认值的时候，没有严格要求
template <class T = int, size_t kMin = 3>
T func(T x, T y)
{
    return  x * y * kMin;
}

void test()
{
    int ia = 10, ib = 20;
    double da = 11.11, db = 22.22;
    cout << "func(ia, ib) = " << func<int, 10>(ia, ib) << endl;;
    cout << "func(ia, ib) = " << func<int, 30>(ia, ib) << endl;;
    cout << "func(ia, ib) = " << func<int, 100>(ia, ib) << endl;;
    cout << "func(da, db) = " << func<double, 2>(da, db) << endl;;
    cout << "func(da, db) = " << func(da, db) << endl;;
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

